﻿@using A2.ERP.Models
@{
    List<t_Products> productsList = ViewBag.products;
}
<style>
</style>
<section id="SysProductsManager">
    <div class="card">
        <div class="card-header">筛选</div>
        <div class="card-body">
            @using (Html.BeginForm("SysProductsTypeManager", "Setting", FormMethod.Get, new
            {
                @class = "searchFrm"
            }))
            {
                <div class="input-group">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            关键字
                        </div>
                    </div>
                    <input type="text" name="keyword" value="" class="input" />
                    <div class="input-group-append">
                        <button class="btn btn-primary">搜索</button>
                    </div>
                </div>
            }
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>入库时间</th>
                <th>库存上限</th>
                <th>库存下限</th>
                <th>成本</th>
                <th>价格</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var products in productsList)
            {
                <tr>
                    <td>@products.ProductsID</td>
                    <td>@products.ProductsName</td>
                    <td>
                        @products.BeginEnterDate
                    </td>
                    <td>
                        @products.UpperLimit
                    </td>
                    <td>
                        @products.LowerLimit
                    </td>
                    <td>
                        @products.Cost
                    </td>
                    <td>
                        @products.Price
                    </td>
                    <td>
                        <a data-route="/setting/editProducts?id=@products.ProductsID">
                            <button class="btn btn-sm btn-primary">
                                <i class="icon SkyUI icon-edit"></i>
                                修改
                            </button>
                        </a>
                        <button class="btn btn-sm btn-danger">
                            <i class="icon SkyUI icon-close"></i>
                            删除
                        </button>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</section>

<script>
    ;
    !function () {
        var $searchFrm = $('#SysProductsManager .searchFrm');

        $searchFrm.submit(function (e) {
            e.preventDefault();

            $searchFrm.ajaxSubmit(function (data) {
                e.preventDefault();

                $tab.reloadTab('#SysProductsManager', [{
                    keyword: $('#SysProductsManager .searchFrm input[name=keyword]').val()
                }]);
            });
        });
    }();
</script>